package com.wml.sellPhone.service.impl;

import com.wml.sellPhone.dao.OrderMapper;
import com.wml.sellPhone.pojo.Order;
import com.wml.sellPhone.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单服务实现类
 *
 * @author Hayes
 * @date 2018-06-29 22:15
 */
@Service
public class OrderServiceImpl implements IOrderService {

    @Autowired
    OrderMapper orderMapper;

    /**
     * 根据订单实例保存
     * @param order 订单实例
     * @return
     */
    @Override
    public boolean save(Order order) {
        return orderMapper.insert(order) > 0;
    }

    /**
     * 根据订单码查询
     * @param code 订单码
     * @return
     */
    @Override
    public Order selectBySerialNumber(String code) {
        return orderMapper.selectBySerialNumber(code);
    }
}
